import Vue from 'vue'
import App from './App.vue'

//引入无界微前端
// vue2
import WujieVue from "wujie-vue2";

// vue3
// import WujieVue from "wujie-vue3"; 
import lifecycles from "../config/lifecycles.js";
// const { setupApp, preloadApp, bus } = WujieVue;
const { setupApp, preloadApp } = WujieVue;
Vue.use(WujieVue);

// const props = {
//   jump: (name) => {
//     router.push({ name });
//   },
// };

//设置子应用demo
setupApp(
  {
  name: "vue3Child1",
  url: "http://localhost:5173/",
  exec: true,
  // props,
  alive: false,
  fetch: function fetch(url, options) {
    //console.log("fetch.url:=",url,options)
    return window.fetch(url, { ...options, credentials: "omit" });
  },
  ...lifecycles,
}); 


// setupApp(
// {
//   name: "reactChild1",
//   url: "http://localhost:9000",
//   exec: true,
//   // props,
//   alive: false,
//   fetch: function fetch(url, options) {
//     //console.log("fetch.url:=",url,options)
//     return window.fetch(url, { ...options, credentials: "omit" });
//   },
//   ...lifecycles,
// }); 

// 预加载
preloadApp({
  name: "vue3Child1",
});

Vue.config.productionTip = false

new Vue({
  render: h => h(App),
}).$mount('#app')
